using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Colorprj
{
    public partial class frmProduct : Form
    {

        ProductMasterData pmd = new ProductMasterData();

        public frmProduct()
        {
            InitializeComponent();
        }

        private void fontDialog1_Apply(object sender, EventArgs e)
        {

        }

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {

        }

        private void frmProduct_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'colorPrjDataSet.Product' table. You can move, or remove it, as needed.
            this.productTableAdapter.Fill(this.colorPrjDataSet.Product);

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            bool isValid = true;
            if ( txtProductName.Text.Trim().Equals("")) {

                MessageBox.Show ( "productName can not be null");
                isValid = false;
                
            }
            if (txtProductCd.Text.Trim().Equals(""))
            {

                MessageBox.Show ("product Code can not be null");
                isValid = false;
                
            }
            if (isValid)
            {
                pmd.AddProduct(txtProductCd.Text, txtProductName.Text);
                this.productTableAdapter.Fill(this.colorPrjDataSet.Product);
                //dataGridView1.Refresh();  
            }
        }

        private void dataGridView1_Click(object sender, EventArgs e)
        {
            string aa = "";
        }
    }
}